﻿<navigation:Page 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/datagrid" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="B2B.Views.Home"
           xmlns:src="clr-namespace:B2B.Extensions" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           mc:Ignorable="d"
           d:DesignWidth="640" d:DesignHeight="480" Width="1024" Height="800"
           Title="Home Page">
    <UserControl.Resources>
        <src:ByteToImageConverter x:Name="binaryConverter" x:Key="byteToImageConverter"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Margin="0,0,0,8">
        <Grid.RowDefinitions>
            <RowDefinition Height="0"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="654"/>
            <RowDefinition Height="0"/>
        </Grid.RowDefinitions>
        <Grid Margin="0" Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.243*"/>
                <ColumnDefinition Width="0.757*"/>
            </Grid.ColumnDefinitions>
            <Border BorderBrush="#FF504E4E" BorderThickness="1" Margin="2,5,0,0" CornerRadius="5">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF871B20" Offset="0"/>
                        <GradientStop Color="#FFB3493B" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>
                <Grid Margin="2,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0*"/>
                        <RowDefinition Height="0.045*"/>
                        <RowDefinition Height="0.046*"/>
                        <RowDefinition Height="0.909*"/>
                    </Grid.RowDefinitions>
                    <TextBox Margin="2,0,67,0" x:Name="txtStokKodu" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Center"/>
                    <Button Content="ARA" HorizontalAlignment="Right" Margin="0,0,2,0" Grid.Row="1" Width="55" VerticalAlignment="Center" Click="Button_Click_1" Height="24" FontFamily="Cambria" FontSize="16"/>
                    <TextBlock Margin="0,5,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Ürün Kategorileri" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="18.667" FontFamily="Cambria"/>
                    <sdk:TreeView x:Name="treeKategori" Margin="0" Grid.Row="3" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="#FFFDFDFD" FontFamily="Cambria" MouseLeftButtonUp="treeKategori_MouseLeftButtonUp" FontSize="12"/>
                </Grid>
            </Border>
            <sdk:DataGrid x:Name="grdData" Grid.Column="1" Margin="5,5,5,26" AutoGenerateColumns="False" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" FontFamily="Cambria" FontSize="10.667">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTemplateColumn>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Image x:Name="thumbNail" Tag="{Binding}" MouseLeftButtonUp="ResmiBuyut"  Width="24" Height="24" VerticalAlignment="Center" Stretch="Fill" Source="{Binding Resim,Converter={StaticResource byteToImageConverter}}"></Image>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTextColumn Binding="{Binding Kodu}" IsReadOnly="True" Width="100" Header="Kodu"/>
                    <sdk:DataGridTextColumn Binding="{Binding Adi}" IsReadOnly="True" Width="380" Header="Adı"/>
                    <sdk:DataGridTextColumn Binding="{Binding Fiyat}" IsReadOnly="True" Header="Fiyat"/>
                    <sdk:DataGridTextColumn Binding="{Binding Doviz}" IsReadOnly="True" Header="Doviz"/>
                    <!--<sdk:DataGridTextColumn Binding="{Binding Iskonto}" IsReadOnly="True" Header="İskonto"/>-->

                    <sdk:DataGridTemplateColumn>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Image x:Name="favorite" Tag="{Binding}" MouseLeftButtonUp ="favoriyeEkle"  Width="24" Height="24" VerticalAlignment="Center" Source="add.png" Stretch="Fill"></Image>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Image x:Name="favoritesil" Tag="{Binding}" MouseLeftButtonUp ="favoridenSil"  Width="24" Height="24" VerticalAlignment="Center" Source="sil.png" Stretch="Fill"></Image>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Header="Miktar" Width="55">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox x:Name="txtMiktar" TextAlignment="Center"  Text="{Binding Miktar, Mode=TwoWay}" HorizontalAlignment="Center" FontSize="16" Width="55" Background="#FFFFFDD8" BorderBrush="{x:Null}" ></TextBox>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="50">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Button Content="btnekle.jpg" Tag="{Binding}" Height="24" Cursor="Hand" Click="SipariseEkle" Background="{x:Null}" BorderBrush="Black" Foreground="{x:Null}">
                                    <Button.ContentTemplate>
                                        <DataTemplate>
                                            <Image Source="{Binding}" VerticalAlignment="Stretch"  HorizontalAlignment="Stretch" Stretch="Fill" />
                                        </DataTemplate>
                                    </Button.ContentTemplate>
                                </Button>
                                <!--<Button Tag="{Binding}" Content="Ekle" Click="SipariseEkle" ></Button>-->
                                <!--<Image x:Name="btnEkle" Tag="{Binding}" MouseLeftButtonUp ="SipariseEkle"  Height="24" VerticalAlignment="Center" Source="btnekle.jpg" Stretch="Fill"></Image>-->
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
            <sdk:DataPager x:Name="PagerGrid" Grid.Column="1" Margin="5,0" PageSize="22" VerticalAlignment="Bottom"/>
        </Grid>
        <Border BorderThickness="1" Margin="2,0" Grid.Row="1" CornerRadius="5" d:LayoutOverrides="GridBox" BorderBrush="Black">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF871B20" Offset="0"/>
                    <GradientStop Color="#FFB3493B" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <Grid Margin="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="0"/>
                    <ColumnDefinition Width="168"/>
                    <ColumnDefinition Width="163"/>
                    <ColumnDefinition Width="106"/>
                    <ColumnDefinition Width="149.666"/>
                    <ColumnDefinition Width="0"/>
                </Grid.ColumnDefinitions>
                <StackPanel Margin="5,4,0,4" Orientation="Horizontal">
                    <TextBlock x:Name="txtFirma" Foreground="White" FontFamily="Tahoma" FontSize="16" Margin="0" VerticalAlignment="Center"/>
                    <HyperlinkButton x:Name="btnCikis" Content="Çıkış" Foreground="#FFF5EC0A" FontSize="16" FontFamily="Cambria" FontWeight="Bold" d:LayoutOverrides="Height" RenderTransformOrigin="0.513,0.45" Margin="5,0,0,0" Click="btnCikis_Click" Width="39"/>
                </StackPanel>
                <TextBlock x:Name="txtDoviz" Grid.Column="2" Margin="0,4" TextWrapping="Wrap" Foreground="#FFFBFBFB" TextAlignment="Center" FontFamily="Cambria" FontSize="16"/>
                <HyperlinkButton Content="Siparişi Tamamla" Grid.Column="5" Margin="10,4,5,4" Foreground="#FFF5EC0A" FontSize="16" FontWeight="Bold" FontFamily="Cambria" Click="SiparisTamamla"/>
                <HyperlinkButton x:Name="btnFavoriListem" Content="Favori Listem" Grid.Column="4" Margin="2,4" Foreground="#FFF5EC0A" FontSize="16" FontWeight="Bold" FontFamily="Cambria" Click="FavoriListem"/>
                <HyperlinkButton x:Name="btnAnlasmaliUrunler" Content="Anlaşmalı Ürünlerim" Grid.Column="3" Margin="2,4" Foreground="#FFF5EC0A" FontSize="16" FontWeight="Bold" FontFamily="Cambria" Click="AnlasmaliUrunlerim"/>
            </Grid>
        </Border>
        <toolkit:BusyIndicator BusyContent="Lütfen bekleyiniz..." Grid.Column="1" Grid.Row="2" x:Name="bsyIndic" HorizontalAlignment="Center" VerticalAlignment="Center" IsBusy="False"/>
    </Grid>
</navigation:Page>
